//
//  WHInFailureCell.m
//  SquirrelSeller
//
//  Created by 邓伟浩 on 2019/1/6.
//  Copyright © 2019 邓伟浩. All rights reserved.
//

#import "WHInFailureCell.h"
#import "WHNormalDesCell.h"

@interface WHInFailureCell ()<UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) UITableView *dataTableView;
@property (nonatomic, strong) NSArray *tipsArray;
@property (nonatomic, strong) NSArray *desArray;

@end

@implementation WHInFailureCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self initParams];
        [self setUpInFailureUI];
    }
    return self;
}

- (void)initParams {
    _tipsArray = @[@"快递类型", @"运单号", @"取件号", @"收件人电话"];
    
}

- (void)setUpInFailureUI {
    
    [self.contentView addSubview:({
        _dataTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
        _dataTableView.delegate = self;
        _dataTableView.dataSource = self;
        [_dataTableView registerClass:[WHNormalDesCell class] forCellReuseIdentifier:NSStringFromClass([WHNormalDesCell class])];
        _dataTableView.tableFooterView = [UIView new];
        _dataTableView.backgroundColor = KWhiteColor;
        _dataTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _dataTableView.scrollEnabled = NO;
        _dataTableView;
    })];
    
    [_dataTableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self.contentView);
    }];
}

#pragma mark - —————— UITableViewDelegate & UITableViewDataSource

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 4;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    WHNormalDesCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([WHNormalDesCell class]) forIndexPath:indexPath];
    cell.tipsLabel.text = _tipsArray[indexPath.row];
    cell.desLabel.text = _desArray[indexPath.row];
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return kRealwidth(35);
}

- (void)setInFilureModel:(WHInFailureModel *)inFilureModel {
    _inFilureModel = inFilureModel;
    
    _desArray = @[@"中通", @"1234234242", @"1", @"1241242342"];
    [_dataTableView reloadData];
}

@end
